//
//  registerController.m
//  pmmSS
//
//  Created by Mac book on 2017/9/5.
//  Copyright © 2017年 WTFSSD. All rights reserved.
//

#import "registerController.h"


@interface registerController ()

@property(nonatomic,strong)UILabel *code_iconlabel,*codeLabel,*promptingLabalOne,*promptingLabalTwo;

@property(nonatomic,strong)UITextField *codeTextfield;

@property(nonatomic,strong)UIButton *codeBtn;

@end

@implementation registerController

- (void)viewDidLoad {

    [super viewDidLoad];


    //自定义

    self.userLabel.text = @"帐号";
    self.passwordLabel.text = @"密码";
    self.userNameTextfield.placeholder = @"请输入您的手机号";
    self.passWordTextfield.placeholder = @"请输入密码";
    [self.loginBtn setTitle:@"注册" forState:UIControlStateNormal];

    WeakSelf(weakSelf);

    [self.loginBtn mas_updateConstraints:^(MASConstraintMaker *make) {
        make.centerX.mas_equalTo(weakSelf.view);
        make.top.equalTo(weakSelf.passwordLabel.mas_bottom).offset(autoScaleH(25) + 0.5+ autoScaleH(50));
        make.width.mas_equalTo(GET_FRAME_WIDTH(weakSelf.view)-20);
        make.height.mas_equalTo(autoScaleH(35));
        
    }];

    [self craeteLabel];
    [self createTextfield];
    [self cretaebtn];

}

-(void)craeteLabel{

    WeakSelf(weakSelf);

    _code_iconlabel = [HMLabel createLabelWithText:@"验证码" andTextColor:[UIColor whiteColor] andBgColor:nil andFont:[UIFont fontWithName:default_fontname size:autoScaleW(18)] andTextAlignment:NSTextAlignmentLeft];

    [self.view addSubview:_code_iconlabel];

    [_code_iconlabel mas_makeConstraints:^(MASConstraintMaker *make) {

        make.left.mas_equalTo(10);
        make.top.equalTo(weakSelf.passwordLabel.mas_bottom).offset(autoScaleH(2));
        make.width.mas_equalTo(autoScaleW(80));
        make.height.mas_equalTo(autoScaleH(50));
        
    }];

    //划线

    UIView *lineView = [[UIView alloc] init];
    lineView.backgroundColor = View_BackgroundColor;
    [self.view addSubview:lineView];

    [lineView mas_makeConstraints:^(MASConstraintMaker *make) {

        make.left.mas_equalTo(10);
        make.top.equalTo(weakSelf.code_iconlabel.mas_bottom).offset(0.5);
        make.width.mas_equalTo(GET_FRAME_WIDTH(weakSelf.view)-10);
        make.height.mas_equalTo(0.5);

    }];

//------------**********------------

    _promptingLabalOne = [HMLabel createLabelWithText:@"点击注册表示同意《用户服务协议》" andTextColor:[UIColor whiteColor] andBgColor:nil andFont:[UIFont fontWithName:default_fontname size:autoScaleW(12)] andTextAlignment:NSTextAlignmentCenter];

    [self.view addSubview:_promptingLabalOne];

    [_promptingLabalOne mas_makeConstraints:^(MASConstraintMaker *make) {

        make.centerX.mas_equalTo(weakSelf.view);
        make.top.equalTo(weakSelf.loginBtn.mas_bottom).offset(autoScaleH(10));
        make.width.mas_equalTo(weakSelf.loginBtn);
        make.height.mas_equalTo(autoScaleH(20));

    }];

//------------**********------------

    _promptingLabalTwo = [HMLabel createLabelWithText:@"已有账号立即登陆" andTextColor:[UIColor whiteColor] andBgColor:nil andFont:[UIFont fontWithName:default_fontname size:autoScaleW(15)] andTextAlignment:NSTextAlignmentCenter];

    _promptingLabalTwo.tag = 201;

    UITapGestureRecognizer *rec1 = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(touchLable:)];


    [_promptingLabalTwo addGestureRecognizer:rec1];
    _promptingLabalTwo.userInteractionEnabled=YES;

    [self.view addSubview:_promptingLabalTwo];

    [_promptingLabalTwo mas_makeConstraints:^(MASConstraintMaker *make) {

        make.centerX.mas_equalTo(weakSelf.view);
        make.top.equalTo(weakSelf.promptingLabalOne.mas_bottom).offset(autoScaleH(20));
        make.width.mas_equalTo(weakSelf.loginBtn);
        make.height.mas_equalTo(autoScaleH(25));
        
    }];



}

-(void)createTextfield{

    WeakSelf(weakSelf);
    //------------**********------------
    _codeTextfield = [HMTextField createTextFieldWithText:@"" andpLlaceholder:@"请输入验证码" andTextColor:[UIColor whiteColor] andBgColor:nil andFont:[UIFont fontWithName:default_fontname size:autoScaleW(18)] andTextAlignment:NSTextAlignmentLeft andTextFieldViewMode:UITextFieldViewModeWhileEditing];

    [_codeTextfield setValue:RGBA(255, 255, 255, 0.5) forKeyPath:@"_placeholderLabel.textColor"];


    [self.view addSubview:_codeTextfield];

    [_codeTextfield mas_makeConstraints:^(MASConstraintMaker *make) {

        make.left.mas_equalTo(weakSelf.userLabel.mas_right).offset(autoScaleW(8));

        make.top.equalTo(weakSelf.passWordTextfield.mas_bottom).offset(autoScaleH(2));
        make.width.mas_equalTo(autoScaleW(175));
        make.height.mas_equalTo(autoScaleH(50));
        
    }];


}

-(void)cretaebtn{

    WeakSelf(weakSelf);

    _codeBtn = [HMButton createButtonWithTitle:@"" andTitleColor:[UIColor whiteColor] andBgColor:nil andImage:nil andBgImage:nil andSelecter:nil andTarget:self andTag:201];

    //    _codeBtn.titleLabel.font = [UIFont fontWithName:default_fontname size:autoScaleW(12)];
    _codeBtn.clipsToBounds = YES;
    _codeBtn.layer.cornerRadius = 4;
    [_codeBtn.layer setBorderColor:[UIColor whiteColor].CGColor];
    [_codeBtn.layer setBorderWidth:0.5];
    [_codeBtn.layer setMasksToBounds:YES];
    [self.view addSubview:_codeBtn];

    [_codeBtn mas_makeConstraints:^(MASConstraintMaker *make) {


        //  make.top.equalTo(weakSelf.userNameTextfield.mas_bottom).offset(autoScaleH(10));
        make.centerY.mas_equalTo(weakSelf.codeTextfield);
        make.right.mas_equalTo(-10);
        make.width.mas_equalTo(autoScaleW(80));
        make.height.mas_equalTo(autoScaleH(24));

    }];

    //------------**********------------

    _codeLabel = [HMLabel createLabelWithText:@"获取验证码" andTextColor:[UIColor whiteColor] andBgColor:nil andFont:[UIFont fontWithName:default_fontname size:autoScaleW(14)] andTextAlignment:NSTextAlignmentCenter];

    [_codeBtn addSubview:_codeLabel];

    [_codeLabel mas_makeConstraints:^(MASConstraintMaker *make) {

        make.centerY.mas_equalTo(weakSelf.codeBtn);
        make.centerX.mas_equalTo(weakSelf.codeBtn);
        make.width.mas_equalTo(autoScaleW(80));
        make.height.mas_equalTo(autoScaleH(24));
        
    }];

}

-(void)clickBtn:(UIButton *)button{


}
-(void)touchLable:(UITapGestureRecognizer *)rec{

    [self dismissViewControllerAnimated:YES completion:nil];

}
- (void)didReceiveMemoryWarning {

    [super didReceiveMemoryWarning];
    
}



@end
